<?php
header('Content-type:text/html;charset=utf8');
date_default_timezone_set('PRC');
//@param
function dd($var){
    echo "<pre style='padding:15px;background:#ccc;border-radius:16px'>";
    if(is_null($var)){
            var_dump($var);

    }else if(is_bool($var)){

            var_dump($var);
    }else{
            print_r($var);
    }
      echo '</pre>';
}


if($_SERVER['REQUEST_METHOD']=='POST'){
    define('IS_POST',true);
}else{
    define('IS_POST',false);
}

function success($msg,$url){
//	"<script>alert(1);location.href='index.php'</script>";
    $str = <<<str
<script>
alert("{$msg}");
location.href = "{$url}";
</script>
str;
    echo $str;exit;
}


function data_to_file($data,$file){
    $newData = var_export($data,true);
    $str = <<<str
<?php
return {$newData};1
?>
str;
    file_put_contents($file,$str);
}